<%--
  Created by IntelliJ IDEA.
  User: 14587
  Date: 2020/11/22
  Time: 21:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

        function showCata(id) {
            //这里得逻辑应该是只有这个列表不存在，我们才要创建
            if ($("#resultBlogs"+id)!=null) {
                $("#resultBlogs"+id).remove();
            }
            $.post({
                url:"${pageContext.request.contextPath}/cata/client/showCata",
                data:{"catalogueName":$("#"+id).text()},
                success:function (data) {
                    var resultList = "<ol id='resultBlogs"+id+"'><ul>";
                    for (let i = 0; i < data.length; i++) {
                        resultList+="<li><h4 style='font-weight: bold'><a style='color: #0b0080' href='${pageContext.request.contextPath}/blog/toBlog?title="+data[i]+"'>"+data[i]+"</a></h4></li>";
                    }
                    resultList+="<li><a id='un"+id+"'href='javascript:void(0)'>收起</a></li></ul></ol>"
                    $(resultList).appendTo($("#"+id+"li"));
                    $("#resultBlogs"+id).show();
                    $("#un"+id).show();
                    $("#un"+id).click(function () {
                        $("#resultBlogs"+id).remove();
                        $("#un"+id).remove();
                    });
                }
            })
        }